const showLogin = {
  env,
  baseConfig: { // 公用配置
    src: iframeUrl, // 登录模块地址
  },
  loginConfig: {
    client: clientType,
    pageMode: 'login',
    interfaceType: 'iframe',
    locale,
    visitModules: {
      loginVisible: true,
    },
    permission: {
      showThirdLogin: {
        visual: false,
        QQ: false,
        wechat: false,
      },
    },
  },
  watch: (cbArgs: LoginReturnData) => { // 公用配置
    this.receiveMessage(cbArgs, onHandleLoginCB);
  },
};

// 打开注册弹框
showRegister = (params?: any, cb?: (a?: any) => any) => {
  const { locale = 'zh-cn', client } = params || {};
  return this.openLogin({
    loginConfig: {
      client: client || 'browser',
      pageMode: 'login',
      interfaceType: 'iframe',
      locale,
      visitModules: {
        ifAdultVisible: true,
      },
    },
  });
};

// 打开用户设置弹框
showSettingVisible = (params?: any, cb?: (a?: any) => any) => {
  const { locale = 'zh-cn', client } = params || {};
  return this.openLogin({
    loginConfig: {
      client: client || 'browser',
      pageMode: 'setting',
      interfaceType: 'iframe',
      locale,
      visitModules: {
        settingVisible: true,
      },
      permission: {
        loginOut: true,
        showThirdLogin: {
          visual: false,
          QQ: false,
          wechat: false,
        },
      },
    },
    data: {
      token: getUCodeSessionAuth(),
    },
  });
};

  // 登出功能
  logout = (cb?: any) => {
    return this.openLogin({
      loginConfig: {
        client: 'browser',
        pageMode: 'loginOut',
        interfaceType: 'iframe',
        locale: 'zh',
      },
      data: {
        data: { loginVisible: false, config: { logout: true } },
        token: getUCodeSessionAuth() || '',
      },
    });
  };
